$(function(){
	// 导航点击函数
	// $.Huitab("#tab_demo .myTabBar span","#tab_demo
	// .myTabCon","myCurrent","click","0");

	// $(".customer_head").on("click","span",function(){
	// $(this).addClass("current_span").siblings().removeClass("current_span");
	// $(".customer_content").hide().eq($(this).index()).show();
	// });
	
	 // 手机号码验证    
    jQuery.validator.addMethod("isMobile", function(value, element) {    
      var length = value.length;    
      return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(value));    
    }, "请正确填写手机号码。");
		
	$("#form").validate({
		debug:true,
		onkeyup:false,
		focusCleanup:false,
		success:"valid",
		invalidHandler: function(form, validator) {return false;},
		submitHandler: function(form) {
			var json = $('#form').serialize();  
	        $.ajax({  
	          type : 'post',  
	          contentType : 'application/json',  
	          url : 'save?' + json,  
	          success : function(data) {
	        	  var rsult = jQuery.parseJSON(data);
	        	  if (rsult.success) {
	        		  alert("保存成功！");
	        		  window.parent.location.reload();
	        	  } else 
	        		  alert("保存失败!" + rsult.message);
	          },  
	          error : function(data) {  
	              alert("保存失败！")  
	          }  
	        });
	        return false;
		},
	});
});
